<template>
  <a-input v-bind="$attrs" class="vben-countdown-input" :size="size">
    <template #addonAfter>
      <CountButton :size="size" :count="count" />
    </template>
    <template #[item]="data" v-for="item in Object.keys($slots).filter((k) => k !== 'addonAfter')">
      <slot :name="item" v-bind="data"></slot>
    </template>
  </a-input>
</template>
<script>
import CountButton from './CountButton';

export default {
  name: 'CountdownInput',
  props: {
    value: {
      type: String
    },
    count: {
      type: Number,
      default: 60
    },
    size: {
      type: String,
      default: 60,
      validator: (v) => ['default', 'large', 'small'].includes(v)
    },
  },
  components: {
    CountButton
  }
}
</script>
<style lang="less">
  @namespace: vben;
   @prefix-cls-countdown-input: ~'@{namespace}-countdown-input';

  .@{prefix-cls-countdown-input} {
    .ant-input-group-addon {
      padding-right: 0;
      background-color: transparent;
      border: none;

      button {
        font-size: 14px;
      }
    }
  }
</style>
